pcolor

 

pcolor is a built-in patch variable that holds the color of the patch. In other words, this primitive changes the background color. Because pcolor is a variable, you need to use the set command to change it. You can change the patch color in the command center on the Interface tab or using the Inspector. Be sure to change the drop-down to “patches” before typing in the command! pcolor can be represented by simply stating the color (e.g., brown, yellow, red; note that there are no quotation marks around the color names) or NetLogo color (a single number). For example, you can write ask patches [set pcolor pink] or ask patches [ set pcolor 15]. Turtles can directly access and change the color of the patch they are on using this primitive. For example: ask turtles [ set pcolor yellow]. To change the color of the turtles, see color .

 

Try it Yourself

 
 
 
 
 
 
 

What's next?

Once you mastered the pcolor primitive, don't stop there. Check out the resources below to improve your NetLogo skills.

 
Similar primitives:
color

built-in turtle characteristic that changes the color of the turtle

Read more
set

Set the value of a variable.

Read more
patches

Address all patches of a model.

Read more
neighbors

reports an agentset containing eight neighboring patches

Read more
 
Learn another primitive